import hashlib

class FirmwareValidator:
    def validate(self, file_path: str, expected_hash: str) -> bool:
        """验证固件"""
        with open(file_path, 'rb') as f:
            file_hash = hashlib.sha256(f.read()).hexdigest()
        return file_hash == expected_hash